﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using CommunityToolkit.Mvvm.Messaging;
using Learn.Pages;
using Learn.ViewModels;

namespace Learn
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public TestViewModel Model;
        public ObservableCollection<StudentViewModel> StudentViewModels = new ObservableCollection<StudentViewModel>();
        public DetailPage MainPage;
        
        public MainWindow()
        {
            InitializeComponent();
            Model = new TestViewModel();
            DataContext = Model;
            Model.StudentViewModels.Add(new StudentViewModel(){Name = "lrj", Id = 1, Grade = 100});
            Model.StudentViewModels.Add(new StudentViewModel(){Name = "zzm", Id = 2, Grade = 99});
            Model.StudentViewModels.Add(new StudentViewModel(){Name = "ykp", Id = 3, Grade = 99});

            MainPage = new DetailPage()
            {
                DataContext = Model,
            };
            WeakReferenceMessenger.Default.Register<string,string>
            (this, "Token1", (s, e) =>
            {
                MessageBox.Show(e);
            });
            MainFrame.Content = MainPage;
        }
    }
}